﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace MT.ControlLibrary.Controls
{
    public class TreeViewItemWithBtn:TreeViewItem
    {
        /// <summary>
        /// Icon 按钮的Content，使用IconFont的形式
        /// </summary>
        public static readonly DependencyProperty BtnContentProperty = DependencyProperty.Register("BtnContent", typeof(string), typeof(TreeViewItemWithBtn), new PropertyMetadata(string.Empty));
        public string BtnContent
        {
            get { return (string)GetValue(BtnContentProperty); }
            set { SetValue(BtnContentProperty, value); } 
        }

        /// <summary>
        /// Hint TextBlock的显示
        /// </summary>
        public static readonly DependencyProperty AddBtnVisibilityProperty = DependencyProperty.Register("AddBtnVisibility", typeof(Visibility), typeof(TreeViewItemWithBtn), new PropertyMetadata(Visibility.Hidden));
        public Visibility AddBtnVisibility
        {
            get { return (Visibility)GetValue(AddBtnVisibilityProperty); }
            set { SetValue(AddBtnVisibilityProperty, value); }
        }

        /// <summary>
        /// Hint TextBlock的显示
        /// </summary>
        public static readonly DependencyProperty HintVisibilityProperty = DependencyProperty.Register("HintVisibility", typeof(Visibility), typeof(TreeViewItemWithBtn), new PropertyMetadata(Visibility.Collapsed));
        public Visibility HintVisibility
        {
            get { return (Visibility)GetValue(HintVisibilityProperty); }
            set { SetValue(HintVisibilityProperty, value); }
        }

        /// <summary>
        /// Hint TextBlock的文字
        /// </summary>
        public static readonly DependencyProperty HintTextProperty = DependencyProperty.Register("HintText", typeof(string), typeof(TreeViewItemWithBtn), new PropertyMetadata(string.Empty));
        public string HintText
        {
            get { return (string)GetValue(HintTextProperty); }
            set { SetValue(HintTextProperty, value); }
        }


        /// <summary>
        /// The command property
        /// </summary>
        public static readonly DependencyProperty BtnCommandProperty = DependencyProperty.Register("BtnCommand", typeof(ICommand), typeof(TreeViewItemWithBtn), new PropertyMetadata(default(ICommand)));        
        public ICommand BtnCommand
        {
            get { return (ICommand)GetValue(BtnCommandProperty);  }
            set {  SetValue(BtnCommandProperty, value);  }
        }

        /// <summary>
        ///  The command Parameter
        /// </summary>
        public static readonly DependencyProperty BtnCommandParameterProperty =  DependencyProperty.Register("BtnCommandParameter", typeof(object), typeof(TreeViewItemWithBtn), new PropertyMetadata(default(object)));
        public object BtnCommandParameter
        {
            get { return (object)GetValue(BtnCommandParameterProperty); }
            set { SetValue(BtnCommandParameterProperty, value); }
        }

        static TreeViewItemWithBtn()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(TreeViewItemWithBtn), new FrameworkPropertyMetadata(typeof(TreeViewItemWithBtn)));
        }

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
        }
    }
}
